from lxml import etree
tree=etree.parse('bilibili.html')
# xpath = tree.xpath('//body/ul')
# print(xpath)
# 查找li标签中带有id属性的
# li_list=tree.xpath('//ul/li[@id]')
# 查找li标签中id属性是1的
# li_list=tree.xpath('//ul/li[@id="1"]')
aa=tree.xpath("//*[@id='i_cecream']/div[2]/main[1]/div[2]/div[1]/div[1]/div[2]/div[1]/div[1]/div[2]/div[1]/h3[1]/a[1]")
print(aa)